<script setup lang="ts">
import HeaderInfo from './cpns/header-info.vue'
import HeaderCrumb from './cpns/header-crumb.vue'

const emit = defineEmits(['foldChange'])
const isFold = ref(false)
const handleIconClick = () => {
  isFold.value = !isFold.value
  // 将事件与状态传递给父组件
  emit('foldChange', isFold.value)
}
</script>

<template>
  <div class="main-header">
    <div class="menu-icon" @click="handleIconClick">
      <el-icon size="28px">
        <component :is="isFold ? 'Expand' : 'Fold'"></component>
      </el-icon>
    </div>
    <div class="content">
      <div class="breadcrumb">
        <header-crumb />
      </div>
      <header-info />
    </div>
  </div>
</template>

<style scoped lang="less">
.main-header {
  display: flex;
  width: 100%;
  margin-top: 10px;
  text-align: center;
  .menu-icon {
    display: flex;
    align-items: center;
    cursor: pointer;
  }

  .content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    padding: 0 18px;
  }
}
</style>
